From 5308792975be1edff0f3ae43b6003d907fe675ed Mon Sep 17 00:00:00 2001 From: "smh22@firebug.cl.cam.ac.uk" Date: Fri, 10 Feb 2006 17:57:13 +0100 Subject: [PATCH] Reset sp on vcpu_prepare; this avoids 'leaking' stack after repeated save/restore/migrate iterations. Should fix various crashes observed with save/restore/migrate of multi VCPU guests. Signed-off-by: Steven Hand --- linux-2.6-xen-sparse/drivers/xen/core/smpboot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c b/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c index d231f85029..8f057f9f7c 100644 --- a/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c +++ b/linux-2.6-xen-sparse/drivers/xen/core/smpboot.c @@ -176,7 +176,7 @@ void vcpu_prepare(int vcpu) #ifdef __i386__ ctxt.user_regs.cs = __KERNEL_CS; - ctxt.user_regs.esp = idle->thread.esp; + ctxt.user_regs.esp = idle->thread.esp0 - sizeof(struct pt_regs); ctxt.kernel_ss = __KERNEL_DS; ctxt.kernel_sp = idle->thread.esp0; @@ -187,9 +187,9 @@ void vcpu_prepare(int vcpu) ctxt.failsafe_callback_eip = (unsigned long)failsafe_callback; ctxt.ctrlreg[3] = virt_to_mfn(swapper_pg_dir) << PAGE_SHIFT; -#else +#else /* __x86_64__ */ ctxt.user_regs.cs = __KERNEL_CS | 3; - ctxt.user_regs.esp = idle->thread.rsp; + ctxt.user_regs.esp = idle->thread.rsp0 - sizeof(struct pt_regs); ctxt.kernel_ss = __KERNEL_DS; ctxt.kernel_sp = idle->thread.rsp0; -- 2.30.2